<?php
/**
 * 咨询师
 *
 * User: kaikaic
 * Date: 2018/10/30
 * Time: 21:34
 */

namespace app\psy\service;

use service\BasicService;
use think\Db;

class ConsultantService extends BasicService {

    public function init() {
        $this->dataTable = ['PsyConsultant', 'PsyConsultantExtends'];
    }

    /**
     * 当前排序最大值,新纪录自动+1
     */
    public function getMaxSort($tableIndex=0) {
        return Db::name($this->dataTable[$tableIndex])->max('sort');
    }

    /**
     * 生成咨询师扩展信息
     */
    public function initExtends($id) {
        $params = array();
        $params['consultant_id'] = $id;
        $params['workflow'] = "";
        $params['words'] = "";
        $params['create_time'] = time();

        return $this->insert($params, 1);
    }
}

